<template>
	<view class="content">
		<view style="margin-top: 150rpx;">
			<u-list height="1300rpx">
				<u-list-item v-for="i in  messageInfo" :key="i">
					<view class="msgcard">
						<view style="margin-top: 10rpx;margin-left: 25rpx;font-weight: bold;color: #a6a6a6;">
							<text>消息</text>
						</view>
						<view class="text1">
							<text style="float: left;color:#868686;">举报人:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap; float: left;
								width: 200rpx;margin-left: 20rpx;">
								<text>{{i.sname}}</text>
							</view>
							<text style="color:#868686;">教师名:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap;
								width: 200rpx;float: right;">
								<text>{{i.nickname}}</text>
							</view>
						</view>
						<view class="text1" style="margin-top: 10rpx;">
							<text style="float: left;color:#868686;">课程名称:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap; float: left;
								width: 460rpx;margin-left: 20rpx;">
								<text>{{i.coursename}}</text>
							</view>
							<view style="margin-top: 10rpx;float: left;">
								<text style="color:#868686;">迟到日期:</text>
								<text style="margin-left: 20rpx;">{{i.delaydate}}</text>
							</view>
						</view>
						<view class="text1" style="float: left;margin-top: 10rpx;width: 95%;">
							<text style="color:#868686;">详细信息:</text>
							<text style="margin-left: 20rpx;">{{i.remarks}}</text>
						</view>
						<view style="float: left;width: 100%;padding-bottom: 30rpx;margin-top: 20rpx;">
							<button v-if="i.status==0" @click="give(i.id)" class="shanbaobtn">上报</button>
							<view v-else style="margin-left: 20rpx;">
								状态:
								<text>已处理</text>
							</view>
							<button v-if="i.status!=2" @click="goout(i.id)" class="bohuibtn">驳回</button>	
							<view v-else style="margin-left: 20rpx;">
								<text>已驳回</text>
							</view>
						</view>
					</view>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>
<script>
	import {
		HNIT_URL
	} from "@/constants/index.js";
	import {
		data
	} from '../../../uni_modules/uview-ui/libs/mixin/mixin';
	export default {

		data() {
			return {
				cname:"",
				coursename:"",
				tname:"",
				delaydate:"",
				remarks:"",
				messageInfo:[],
				sname:""
			};
		},
		methods:{
			queryTeaInfo(){
				let stuid = uni.getStorageSync("name")
				let params={
					stuid: stuid
				}
				this.$request.post( HNIT_URL + "wx/queryInfoTea",params).then(res=>{
					this.messageInfo=res.data
					if(res.code==1){
					
					}
				})
			},
			give(id){
				let params={
					id: id
				}
				this.$request.post(HNIT_URL +"wx/updateTeaStatus",params).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:"none",
						duration:1500
					})},err=>{
						uni.showToast({
							title:"操作超时",
							duration:1500
						})
					}	
				)		
			},
			goout(id){
				let params={
					id: id
				}
				this.$request.post(HNIT_URL +"wx/updateTeaStatusFalse",params).then(res=>{
					uni.showToast({
						title:res.msg,
						icon:"none",
						duration:1500
					})},err=>{
						uni.showToast({
							title:"操作超时",
							icon:"none",
							duration:1500
						})
					}
				)			
			},		
		},
		onLoad() {
			// this.queryTeaInfo();
		}
	}
</script>

<style lang="scss">
	.text1{
		font-weight: bold;
		margin-top: 10rpx;
		margin-left: 20rpx;
		font-size: 35rpx;
	}
	.bohuibtn{
		width: 200rpx;
		height: 80rpx;
		background-color: white;
		float: right;
		margin-right: 20rpx;
		font-weight: bold;
		color: #868686;
		border-radius: 40rpx;
		line-height: 80rpx;
		box-shadow: 0px 2px 6px 0px #cecece;
	}
	.shanbaobtn{
		width: 200rpx;
		height: 80rpx;
		background-color: white;
		float: left;
		margin-left: 20rpx;
		font-weight: bold;
		color: #868686;
		border-radius: 40rpx;
		line-height: 80rpx;
		box-shadow: 0px 2px 6px 0px #cecece;
	}
	page {
		background-color: #F0F0F0;
	}
	.msgcard{
		margin-left: 40rpx;
		margin-top: 45rpx;
		background-color: white;
		width: 90%;
		border-radius: 40rpx;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	
</style>
